import redis


class Config(object):
    SECRET_KEY = "1"
    # 关闭追踪数据库的修改
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 对redis数据库的相关配置
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    # session存储的相关配置
    # 设置session存储到redis中
    SESSION_TYPE = 'redis'
    # redis 的链接对象(给flask-session扩展使用)
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)


class DevelopmentConfig(Config):
    """开发环境"""
    DEBUG = True
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:python@192.168.14.156/formwork?charset=utf8'


class ProductionConfig(Config):
    """生产环境"""
    DEBUG = False


CONFIG = {
    "development": DevelopmentConfig,
    "production": ProductionConfig
}
